package com.ruoyi.common.utils;

import org.springframework.context.annotation.Configuration;
import java.sql.Connection;
import java.sql.DriverManager;

@Configuration
public class Mysql {
    static final String JDBC_DRIVER = "com.mysql.cj.jdbc.Driver";
    static final String DB_URL = "jdbc:mysql://localhost:3306/smart_hosp";
    static final String USER = "root";
    static final String PASS = "wcl970701";
//    static final String PASS = "123456";
    public static Connection  getConn(){
        Connection conn = null;
        try{
            // 注册 JDBC 驱动
            Class.forName(JDBC_DRIVER);
            // 打开链接
            conn = DriverManager.getConnection(DB_URL,USER,PASS);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return conn;
    }


}
